const http = require("http");
const fs = require("fs");
const path = require("path");

http.createServer((req,res) => {

    let filePath = path.join(__dirname,"2.png");
    /**
     * 同步的读取文件内容，读取成功后进行后续操作
     */
    let buf = fs.readFileSync()
    let htmlContent = "<!DOCTYPE html>"+
        "<head></head>"+
        "<body>"+
        "<img src = 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png'>"+
        "</body>"
    "</html>"

    res.end(htmlContent);


}).listen(8080)
console.log("server is listening 8080")
